package com.abberbex;


import org.newdawn.fizzy.World;

public class LevelOneTerrain {

	private Surface[] surfaces = new Surface[12];
	private PortableSurface[] psurfaces = new PortableSurface[2];
	private PortableWall[] pwalls = new PortableWall[2];
	private Wall[] walls = new Wall[6];

	public LevelOneTerrain()
	{
		surfaces[0]= new Surface(0,2*64);
		surfaces[1]= new Surface(64,2*64);
		surfaces[2]= new Surface(2*64,8*64);
		//surfaces[3]= new Surface(3*64,8*64); removed for portable surface
		surfaces[4]= new Surface(4*64,8*64);
		surfaces[5]= new Surface(5*64,8*64);
		surfaces[6]= new Surface(6*64,8*64);
		surfaces[7]= new Surface(7*64,8*64);
		//surfaces[8]= new Surface(8*64,8*64); removed for portable surface
		surfaces[9]= new Surface(9*64,8*64);
		surfaces[10]= new Surface(10*64,2*64);
		surfaces[11]= new Surface(11*64,2*64);
		psurfaces[0] = new PortableSurface(3*64,8*64);
		psurfaces[1] = new PortableSurface(8*64,8*64);
		walls[0] = new Wall((float)5.5*64,0);
		walls[1] = new Wall((float)6*64,0);
		walls[2] = new Wall((float)5.5*64,2*64);
		walls[3] = new Wall((float)6*64, 2*64);
		walls[4] = new Wall((float)5.5*64,3*64);
		walls[5] = new Wall((float)6*64, 3*64);
		pwalls[0] = new PortableWall((float)5.5*64,1*64);
		pwalls[1] = new PortableWall((float)6*64, 1*64);
	}

	public void addToWorld(World world)
	{
		for(int i = 0; i<surfaces.length; i++)
		{
			if(surfaces[i]!=null){
				world.add(surfaces[i]);
			}
		}
		for(int i = 0; i<psurfaces.length; i++){

			world.add(psurfaces[i]);
		}
		for(int i=0; i<walls.length; i++)
		{
			if(walls[i]!=null){
				world.add(walls[i]);
			}
		}
		for(int i=0; i<pwalls.length; i++)
		{
			if(pwalls[i]!=null){
				world.add(pwalls[i]);
			}
		}
	}

	public void draw(){
		for(int i = 0; i<surfaces.length; i++)
		{
			if(surfaces[i]!=null){
				surfaces[i].draw();
			}
		}
		for(int i = 0; i<psurfaces.length; i++)
		{
			psurfaces[i].draw();
		}
		for(int i=0; i<walls.length; i++)
		{
			if(walls[i]!=null){
				walls[i].draw();

			}
		}
		for(int i=0; i<pwalls.length; i++)
		{
			if(pwalls[i]!=null){
				pwalls[i].draw();

			}
		}
	}

	public PortableSurface[] getPortableSurfaces(){
		return psurfaces;
	}
	
	public PortableWall[] getPortableWalls()
	{
		return pwalls;
	}
}
